/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import entities.PASSUser;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author ryuju
 */
@Stateless
public class PASSUserFacade extends AbstractFacade<PASSUser> {
    @PersistenceContext(unitName = "PASS-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public PASSUserFacade() {
        super(PASSUser.class);
    }
    
    public PASSUser findByLoginName(String loginName)
    {
        List<PASSUser> userList = findAll();
        for(PASSUser user : userList)
        {
            if(user.getLoginName().equals(loginName))
            {
                return user;
            }
        }
        return null;
    }
}
